package com.vic.Builder;

import com.vic.Utils.dateUtils;
import com.vic.bean.constant;

import java.io.BufferedWriter;
import java.io.IOException;
import java.util.Date;

/**
 * @Author: Vic Ly
 * 为生成的类添加备注
 */
public class builderComment {
    // 为生成的类添加备注
    public static void addCommentByClass(BufferedWriter bw,String remark) throws IOException {
        /**
         * @description：
         * @date:
         * @author: Vic Ly
         */
        bw.write("/**");
        bw.newLine();
        bw.write(" * "+"@description："+remark);
        bw.newLine();
        bw.write(" * "+"@date："+ dateUtils.format(new Date(),dateUtils.Y_M_D));
        bw.newLine();
        bw.write(" * "+"@author："+ constant.AUTHOR_CLAZZ);
        bw.newLine();
        bw.write(" */");
    }
    // 为生成的属性添加备注
    public static void addCommentByField(BufferedWriter bw, String remark) throws IOException {
        /**
         * xxx
         */
        if (bw == null || remark == null) {
            return;
        }
        if (!remark.contains(constant.SUFFIX_BEAN_QUERY_FUZZY)
                && !remark.contains(constant.SUFFIX_BEAN_QUERY_TIME_START)
                && !remark.contains(constant.SUFFIX_BEAN_QUERY_TIME_END)) {
            bw.write("\t/**");
            bw.newLine();
            // 如果在建立字段时没有建立备注，则生成空
            bw.write("\t * " + remark);
            bw.newLine();
            bw.write("\t */");
            bw.newLine();
        }
    }
}
